package com.wrk._1_语法._04_循环._01_单循环;

import java.util.Scanner;

public class _004_是否为素数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数,判断是否为素数:");
        //接收键盘数据
        int primeNumber =scanner.nextInt();
        //int numberOfTimes =1;
        int number =0;
        //循环判断
        for (int numberOfTimes =1;numberOfTimes<primeNumber;numberOfTimes++){
            if (primeNumber%numberOfTimes==0){
                number++;
            }
        }
        if (number>1){
            System.out.println("不是素数");
        }
        else {
            System.out.println("是素数");
        }
        scanner.close();
    }
}